﻿using System;
using __Able.Network.Packets;

namespace __Able.Network.Connection
{
    public interface IConnection : IDisposable
    {
        /// <summary>
        /// 发送一个包
        /// </summary>
        /// <param name="outPacket">The out packet.</param>
        /// <param name="sync">true为同步发送，false为异步发送</param>
        void Send(_OutPacket outPacket, bool sync);

        /// <summary>
        /// 连接到服务器
        /// </summary>
        bool Connect();

        /// <summary>
        /// 关闭连接
        /// </summary>
        void Close();

        /// <summary>
        /// 连接策略
        /// </summary>
        /// <value></value>
        ConnectionPolicy Policy { get; }

        /// <summary>
        /// 是否处于连接状态
        /// </summary>
        /// <value></value>
        bool IsConnected { get; }

        /// <summary>
        /// 连接ID
        /// </summary>
        /// <value></value>
        string ID { get; }
    }
}
